function storageDentalSecond() {
    var reservationsId = $("#reservationsId").val();
    var num = $("#num").val();
    var treatmentTypes = $("#treatmentTypes").val();
    var consumptionAmount = $("#consumptionAmount").val();
    var toothPositionA = document.getElementById("leftUp").innerHTML;
    var toothPositionB = document.getElementById("rightUp").innerHTML;
    var toothPositionC = document.getElementById("leftDown").innerHTML;
    var toothPositionD = document.getElementById("rightDown").innerHTML;
    var doctor = $("#doctor").val();
    var nurse = $("#nurse").val();
    var id2 = $('input[name="radio"]:checked').val(); //关联的项目
    var amountTotal = $('input[name="radio"]:checked').data("amount"); //关联的项目
    if (consumptionAmount == "" || consumptionAmount == undefined) {
        Feng.error("请输入消费金额！");
        return false;
    }
    $.ajax({
        url: Feng.ctxPath + "/doctorLooked/checkAmount",
        type: "post",
        data: {
            "id2": id2,
            "consumptionAmount":consumptionAmount,
            "amountTotal":amountTotal
        },
        success:function(data){
            if(data==0){
                alert("该项目分配的金额不能超过项目实际金额，请重新分配！")
                window.parent.location.href = Feng.ctxPath + '/doctorLooked/dentalPlaque/' + nur
            }else{
                var toothPosition = "";
                if (toothPositionA.length <= 0 && toothPositionB.length <= 0 && toothPositionC.length <= 0 && toothPositionD.length <= 0) {
                    Feng.error("牙位不能为空！");
                    return false;
                }
                if ((toothPositionA.length + toothPositionB.length + toothPositionC.length + toothPositionD.length) > 1) {
                    Feng.error("牙位只能选择一个！");
                    return false;
                }
                if (toothPositionA.length > 0) {
                    toothPosition = "A" + toothPositionA;
                } else if (toothPositionB.length > 0) {
                    toothPosition = "B" + toothPositionB;
                } else if (toothPositionC.length > 0) {
                    toothPosition = "C" + toothPositionC;
                } else if (toothPositionD.length > 0) {
                    toothPosition = "D" + toothPositionD;
                }
                if(treatmentTypes == "" || treatmentTypes == undefined){
                    Feng.error("请选择治疗种类！");
                    return false;
                }
                if(doctor==null || doctor=="" || doctor==undefined){
                    Feng.error("请选择医生！");
                    return false;
                }
                if(id2==null || id2 == "" || id2 == undefined){
                    Feng.error("请关联项目！");
                    return false;
                }
                $.ajax({
                    url: Feng.ctxPath + "/doctorLooked/storageDentalSecond",
                    type: "post",
                    data: {
                        "reservationsId": reservationsId,
                        "num": num,
                        "treatmentTypes": treatmentTypes,
                        "consumptionAmount": consumptionAmount,
                        "toothPositionA": toothPositionA,
                        "toothPositionB": toothPositionB,
                        "toothPositionC": toothPositionC,
                        "toothPositionD": toothPositionD,
                        "toothPosition": toothPosition,
                        "doctor": doctor,
                        "nurse": nurse,
                        "id2": id2
                    },
                    success: function (data) {
                        Feng.success('操作成功!');
                        window.parent.location.href = Feng.ctxPath + '/doctorLooked/xiaoyapian/' + reservationsId
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                    }
                })
            }
        }
    })
}

function dentallClose() {
    parent.layer.close(parent.layer.getFrameIndex(window.name));
}

